package com.proton.carepatchtemp.login.activity;

import android.os.Bundle;
import android.webkit.WebView;
import android.widget.ImageButton;
import android.widget.TextView;

import com.proton.carepatchtemp.R;
import com.proton.carepatchtemp.base.BaseActivity;
import com.proton.carepatchtemp.utils.eventbus.MainEvent;

public class PrivacyPoliciesActivity extends BaseActivity {

    private ImageButton mBtnBack;
    /**
     * 隐私条款
     */
    private TextView mTitle;
    private WebView mWvContent;

    @Override
    public void dealEvent(MainEvent event) {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_privacy_policies);
        initView();
        if (1 == getIntent().getIntExtra("type", 0)) {
            mTitle.setText("隐私条款");
            mWvContent.loadUrl("file:///android_asset/agreement/privacy.html");
        } else if (2 == getIntent().getIntExtra("type", 0)) {
            mTitle.setText("服务协议");
            mWvContent.loadUrl("file:///android_asset/agreement/service_agreement.html");
        }
        setListener();
    }

    @Override
    protected void setListener() {
        mBtnBack.setOnClickListener(v -> {
            finish();
        });
    }

    @Override
    public void onEventMainThread(MainEvent event) {

    }

    private void initView() {
        mBtnBack = findViewById(R.id.btn_back);
        mTitle = findViewById(R.id.title);
        mWvContent = findViewById(R.id.wv_content);
    }
}
